package com.example.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Optional;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

/**
 * @author renyitong
 * @version 1.0.0
 * @createTime 2025年06月27日
 * @Description
 */
@Component
public class CaseHandlerFactory {

    @Autowired
    private List<CaseHandler> handlers;

    public Optional<CaseHandler> getHandler(CaseContext caseContext){
        return handlers.stream()
                .filter(handler-> handler.matcher().match(caseContext))
                .findFirst();

    }

}
